<%--
  Created by IntelliJ IDEA.
  User: 杨道林
  Date: 2019/3/8
  Time: 13:25
  To change this template use File | Settings | File Templates.
--%>

<%@ page language="java" contentType="text/html; charset=GB2312"
         pageEncoding="utf-8"%>
<%@page import="java.util.*"%>
<HTML><bod>
    <HTML><body bgcolor = yellow><font size = 2>
            <%! public String getDiv(double a,double b){
	 double div = a/b;
	 return ""+div;
}
 public String getAdd(double a,double b){
	 double add = a+b;
	 return ""+add;
 }
 public String getMin(double a,double b){
	 double min = a-b;
	 return ""+min;
 }
 public String getMul(double a,double b){
	 double mul = a*b;
	 return ""+mul;
 }

%>
            <% String A = request.getParameter("sizeA");
	   String B = request.getParameter("sizeB");
	   try{
		   double a = Double.parseDouble(A);
		   double b = Double.parseDouble(B);
		   String addOrMinOrMulOrDiv = request.getParameter("R");
		   if(addOrMinOrMulOrDiv .equals("div")){
			   if(addOrMinOrMulOrDiv .equals("div")){
				   out.println("<br>选择除法的结果为:"+getDiv(a,b));
			   }
		   }
		    if(addOrMinOrMulOrDiv .equals("add")){
			   out.println("<BR>选择加的结果为:"+getAdd(a,b));
		   }
		    if(addOrMinOrMulOrDiv .equals("min")){
			   out.println("<br>选择减的结果为:"+getMin(a,b));
		   }
		    if(addOrMinOrMulOrDiv .equals("mul")){
			   out.println("<br>选择乘的结果为:"+getMul(a,b));
		   }
	   }catch(NumberFormatException ee){
		   out.println("<br>请输入数字字符");
	   }

	%>
    </body>
    </html>
